package com.csproj.dispatch.repository;

import com.csproj.dispatch.domain.Logistics;
import org.springframework.stereotype.Repository;

import org.springframework.data.jpa.repository.*;

import java.util.List;


/**
 * Spring Data JPA repository for the Logistics entity.
 */
@SuppressWarnings("unused")
@Repository
public interface LogisticsRepository extends JpaRepository<Logistics, String> {

    public Logistics findFirstByContainerIdAndDeletionTimeIsNullOrderByCreationTimeDesc(String containerId);


    @Modifying
    @Query(value = "update Logistics l set l.deletedFlag=1 where id = ?1")
    public void deleteLogisticsById(String id);


    @Query( " FROM Logistics where containerId in (?1) " )
    List<Logistics> findByContainerIds(List<String> containerIds);
}
